package com.forekenow.work0723;

public class Rectangle {
    private int length;
    private int width;

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }


    public Rectangle(int length, int width) {
        this.length = length;
        this.width = width;
    }

    public int getArea(){
         return getLength()*getWidth();
    }
    public int getPer(){
       return getLength()*2+getWidth()*2;
    }
    public void showAll(Rectangle r1){
        int area = r1.getArea();
        System.out.println("面积"+area);
        int Per = r1.getPer();
        System.out.println("周长"+Per);
        int width = r1.getWidth();
        System.out.println("宽"+width);
        int length = r1.getLength();
        System.out.println("长"+length);
    }

    public static void main(String[] args) {
        Rectangle r1 = new Rectangle(2,1);
        r1.showAll(r1);
    }
}
